/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
 * @brief map-messenger /map-messenger/include/ModUtils.h
 * Copyright (C) Matheus Neder, Amanda Duarte, Priscila Cardoso 2010
 * 
 * ModUtils.h is free software: you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * ModUtils.h is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License along
 * with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
/**
 * @brief map-messenger /map-messenger/include/ModUtils.h
 * @file ModUtils.h
 * @date 05/06/2010
 * @author Matheus Neder <matheusneder@gmail.com>
 * @author Amanda Duarte <mandinhaduarte89@gmail.com>
 * @author Priscila Cardoso <japinha-htinha@hotmail.com>
 */

#ifndef MODUTILS_H_
#define MODUTILS_H_

#include "MapInteger.h"
#include "ModUtilException.h"

/**
 * @brief Obtem a forma reduzida de a^e (mod n)
 */
MapInteger modPow(MapInteger base, MapInteger exponent, MapInteger modulo)
		throw (ModUtilException);

/**
 * @brief Realiza o teste de Fermat para um numero
 * Obs: Supoe semente do gerador de numeros randonicos plantada (srand)
 * @return TRUE se o numero provavelmente for primo
 */
bool isFermatPrime(MapInteger num);

MapInteger generateFermatPrime(MapInteger min = 2);

MapInteger generatePrime(MapInteger min = 2);

//MapInteger generateFermatPrimeMultiThreaded(MapInteger min = 2, int maxThreads =
//		4);
//
//MapInteger generateFermatPrimeSingleThreaded(MapInteger min = 2);

#endif /* MODUTILS_H_ */
